#pragma once

#include <boost/optional.hpp>
#include <engine.core/Device.hpp>
#include <engine.core/vertices.hpp>

#include "exports.hpp"
#include "PhysicsActor.hpp"
#include "RayCast.hpp"




class ENGINE_PHYSICS_API PhysicsDevice : Device
{
public:

	typedef boost::optional<SceneRayCast>   RayCastResult;

public:

	PhysicsDevice();
	virtual ~PhysicsDevice();



	/**
	 * Reports the name of the Device.
	 */
	QString name() const;



	virtual PhysicsActorPtr createActor(const ActorDesc &desc) = 0;


	/**
	 * Shoot a ray (in world space) and test if the ray hits this actor or
	 * not.
	 */
	virtual RayCastResult rayCast(const ray& ray_) const = 0;



	/**
	 * Fill the following vertex- & indexlist with data about every actor, to
	 * be able to visualize them alltogether.
	 */
	virtual void debugRender(MeshVertices& vertices, Indices32 &indices) const = 0;



	/**
	 * Create a PhysicsDevice of the specified type.
	 */
	static DevicePtr PhysicsDevice::create(const EngineInfo& info);
};
///////////////////////////////////////////////////////////////////////////////////////////////////

DEFINE_STRICT_PTR(PhysicsDevice);
